import 'auth/ApiBase.dart';
import 'dio/BaseModel.dart';
import 'dio/DioClient.dart';

class OrderApi extends ApiBase {
  // 获取订单列表
  Future<Map<String, dynamic>> getOrders() async {
    final response = await dio.get('/getRouters');
    return response.data;
  }

  Future<Map<String, dynamic>> getRouters() async {
    var numbers = {};
    numbers['username'] = 'userName';
    numbers['password'] = 'password';
    BaseModel response =  await DioClient().doDio("/getRouters", method: HTTPMethod.post, data: numbers, loading: true);

    return response.data;
  }

  Future<Map<String, dynamic>> getDevice() async {
    final response = await dio.get('/device/getDevice');

    return response.data;
  }

  // 获取订单详情
  Future<Map<String, dynamic>> getOrderDetail(String orderId) async {
    final response = await dio.get('/api/orders/$orderId');
    return response.data;
  }

  // 提交订单
  Future<Map<String, dynamic>> submitOrder(Map<String, dynamic> orderData) async {
    final response = await dio.post('/api/orders', data: orderData);
    return response.data;
  }
}